?><?
function em($text){
	$timer=getTimer("ErrorMeessage");
	?><br /><font color="green">[<?=$text?>]<?=" at:".$timer?></font><?
	StartTimer("ErrorMeessage");
	flush();
}
function me($text){em($text);}

function vd(&$obj){
	?><pre><?
	var_export($obj);
	?></pre><?
	die();
}
function vnd(&$obj){
	?><pre><?
	var_export($obj);
	?></pre><?
}
function dpb(){
	$debug=debug_backtrace();
	$log="";
	foreach($debug as $key=>$func){
		if(isset($func["class"]))$dclass=$func["class"];else $dclass="";
		if(isset($func["type"]))$dtype=$func["type"];else $dtype="";
		if(isset($func["function"]))$dfunc=$func["function"];else $dfunc="";
		if(isset($func["args"]))$dargs=$func["args"];else $dargs="";		
		if($dargs&&is_array($dargs)){
			//var_export($dargs);
		}
		$log=$dclass.$dtype.$dfunc."(".$dargs.")<br>\n".$log;
	}
	return $log;
}

function debug_process_array($array){
	if(is_array($array)||is_object($array)){
	?><ul><?
	foreach($array as $key=>$value){
		?><li><?=$key?>=<?=$value?></li><?
		debug_process_array($value);
	}
	?></ul><?
	}
}
function debug(){
	var_dump(dpb());
}

function get_data_dump($data){
	ob_start();
	debug_process_array($data);
	$content=ob_get_contents();
	ob_end_clean();
	return $content;

}
function is_now_update(){
	return file_exists(tmpBackup);
}
function sql_debug_on(){
	global $sql_debug;
	$sql_debug=true;
}
function sql_debug_off(){
	global $sql_debug;
	$sql_debug=false;
}
function sql_debug_is(){
	global $sql_debug;
	if(isset($sql_debug)&&$sql_debug===true){
		return true;
	}else{
		return false;
	}
}

function flog($data){	
	$h=fopen("grape.log","a+");
	$message="";
	if(is_array($data)){
		$message.=var_export($data, true);
	}else{
		$message=$data."\n";
	}
	fwrite($h,$message);
	fclose($h);
}


function debug_message($message){
	global $file_debug;
	$timing=getTimer("Debug");
	echo $message." in ".$timing."ms. \r\n";
	StartTimer("Debug");
}
function getPHPVer(){
	$ver=explode("\.",phpversion());
	return $ver[0];
}

function svn_path(){
	global $svn_path;
	return $svn_path;
}

